package com.jy.adscm.hcPlan.controller;


import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.hcPlan.bean.Hc_plan_materiel;
import com.jy.adscm.hcPlan.service.Hc_plan_materielService;
import com.jy.adscm.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 物料清单 前端控制器
 * </p>
 *
 * @author yyy
 * @since 2018-09-11
 */
@RestController
@RequestMapping("/adscm/hcplan/hcPlanMateriel")
public class Hc_plan_materielController {
    @Autowired
    Hc_plan_materielService hc_plan_materielService;


    /**
     * 查询所有物料清单
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/queryAllMaterielList")
    public SimpleCoreResponse queryAllMaterielList() throws AdscmSystemException{

        return new SimpleCoreResponse("200","查询成功",hc_plan_materielService.queryAllMaterielList());

    }

    /**
     * 增加物料标准配置
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/addMaterielConfig")
    public SimpleCoreResponse addMaterielConfig(@RequestBody Hc_plan_materiel materiel) throws AdscmSystemException {

        hc_plan_materielService.addMaterielConfig(materiel);
        return new SimpleCoreResponse("200","增加配置成功",null);
    }
    /**
     * 修改物料标准配置
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/editMaterielConfig")
    public SimpleCoreResponse editMaterielConfig(@RequestBody Hc_plan_materiel materiel) throws AdscmSystemException {
        hc_plan_materielService.editMaterielConfig(materiel);
        return new SimpleCoreResponse("200","修改配置成功",null);
    }
    /**
     * 删除物料标准配置
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/delMaterielConfig/{id}")
    public SimpleCoreResponse delMaterielConfig(@PathVariable Integer id) throws AdscmSystemException {
        hc_plan_materielService.delMaterielConfig(id);
        return new SimpleCoreResponse("200","删除配置成功",null);
    }
    /**
     * 查询物料供应商
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/getAllHcPlanSupplier")
    public SimpleCoreResponse getAllHc_plan_supplier() throws AdscmSystemException {

        return new SimpleCoreResponse("200","查询成功",hc_plan_materielService.getAllHc_plan_supplier());
    }

}

